import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.pylab import *
import warnings
warnings.filterwarnings('ignore')

all_df=pd.read_csv('train_titanic.csv')

def a(x):
    return str(x)[0]

all_df['cabin_type']=all_df['Cabin'].map(a)
all_df.loc[all_df['cabin_type']=='G','cabin_type']='O'
all_df.loc[all_df['cabin_type']=='T','cabin_type']='O'

import seaborn as sns

sns.countplot(data=all_df,x='cabin_type',hue='Survived',order=['A','B','C','D','E','F','O','n'],hue_order=[1,0])
plt.show()